//========encoding:utf-8=========
/*
 * @describe:  三目运算符
 * @author:mhao
 * @copyright:chinasoft.cn
 * @date:2020年3月16日   下午7:26:11
 */
package edu.chinasoft.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserHandler implements Controller{
	private Logger logger = LoggerFactory.getLogger(UserHandler.class);
	 @Override
	    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
	        logger.info("UserHandler>>>handleRequest start ……");
	        String userName = request.getParameter("user_name");
	        String userPassword = request.getParameter("user_password");
	        logger.info("用户名为："+userName+"；密码为："+userPassword+"。");
	        //request  容器
	        /*把数据保存到request容器*/
	        request.setAttribute("key01", userName);
	        request.setAttribute("key02", userPassword);

	        //请求转发
	        request.getRequestDispatcher("/loginsuccess.jsp").forward(request, response);
	        logger.info("UserHandler>>>handleRequest end ……");
	        return modelAndView;
	    }

}
